<template>
  <a-input :addon-before="label + '：'" v-model="myValue" @change="valueChange" :placeholder="'请输入' + label" />
</template>

<script>
export default {
  props: {
    label: {
      type: String,
      require: true
    },
    index: {
      type: Number,
      default: null
    }
  },
  data() {
    return {
      myValue: '' // 输入框绑定值
    }
  },
  mounted() {},
  methods: {
    // 输入框值change事件
    valueChange(e) {
      this.$emit('change', e.target.value, this.index)
    },
    // 重置内容
    reset() {
      this.myValue = ''
      this.$emit('change', '', this.index)
    }
  }
}
</script>

<style lang="less" scoped>
/deep/.ant-input-group-addon {
  text-align: right;
  font-size: 1rem;
  color: #333333;
  background: #ffffff;
  border: none;
}

/deep/.ant-input {
  border-radius: 4px !important;
}
</style>
